﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TemplateTool.Response
{
    public class ResultBuilder
    {
        public static Response<T> SuccessResult<T>(T data, string message = "请求成功")
        {
            return new Response<T>
            {
                Code = 0,
                Message = message,
                Data = data
            };
        }


        public static Response<T> FailResult<T>(T data, string message = "请求失败", int code = 99)
        {
            return new Response<T>
            {
                Code = 0,
                Message = message,
                Data = data
            };
        }

    }


    public class Response<T>
    {
        /// <summary>
        /// 响应信息
        /// </summary>
        public string Message { get; set; }

        /// <summary>
        /// 响应状态码
        /// </summary>
        public int Code { get; set; }

        /// <summary>
        /// 响应对象
        /// </summary>
        public T Data { get; set; }

    }


}
